<%--
 *  File:    OrgSelectPop.jsp
 *  @Author: Kevinfan
 *  Date:    4/11/2011
 *
 *  Copyright (C) 2000 - 2012 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>


<%@ include file="/inc/SessionTimeout.inc"%>
<%@ page language="java"%>
<%@ page import="java.util.*"%>
<%@ page import="org.apache.log4j.Category"%>

<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom"%>

<%
  //init param
  Category cat = Category.getInstance("jsp.HospitalSelectPop");  
  String strModuleName = "TDR";
  String contextPath = request.getContextPath();
  String strTableName = "v_hospitalsummary";
  Integer sourceorgid = new Integer(-1);
%>
<%@ include file="/inc/PageDefault.inc"%>
<html>
<head>
<title>Add</title>
<PageFlow:CheckPageFlow pageName="p_hospitalsummarypopnew" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/cn/main.css"
	type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/cn/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/FuncLib.js"></script>
<script type="text/javascript" src="<%=contextPath%>/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="<%=contextPath%>/js/artDialog/artDialog.source.js?skin=default"></script>
<script type="text/javascript" src="<%=contextPath%>/js/artDialog/plugins/iframeTools.source.js"></script>
<%@ include file="/inc/SummaryDivision.inc"%>
<%  
  Vector orgs = (Vector)pageContext.getAttribute("totalsummary");
  if(orgs == null) orgs = new Vector();  
%>

<script language="JavaScript">
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(frm,actionvalue,orderbyname);
  editform.action = "HospitalSelectPopNew.jsp?maxitem=8&<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}
function page_setHospital(id,name,code,level) {
	  parent.page_setHospital(id,name,code,level);
	  //jQuery(artDialog.open.origin.page_setHospital(id,name,code,level)));
	  artDialog.close();
}
</script>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<form name="frm" method="post">
<table width="100%" cellspacing="0" cellpadding="0" height="100%">
	<input type="hidden" name="pagename" value="p_hospitalsummarypopnew">
	<input type="hidden" name="actionname">
	<tr>
		<td valign="top">
		<table width="100%" cellspacing="0" cellpadding="0">
			<tr>
				<td class="summary_top"></td>
			</tr>
		</table>
		<table width="100%" cellspacing="0" cellpadding="0">
			<%@ include file="/inc/SummarySearch.inc"%>
		</table>
		<table width="100%" border="1" cellpadding="0"
			bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0"
			align="center">
			<tr class="deepblue-left">
				<td class="title_center" width="1%">&nbsp;</td>
				<td class="title_center" width="25%">&nbsp;<a
					href="javascript:page_summary('orderby','hospitalcode')"><%= label.getLabelName("L_HospitalCode") %></a></td>
				<td class="title_center" width="49%">&nbsp;<a
					href="javascript:page_summary('orderby','hospitalname')"><%= label.getLabelName("L_HospitalName") %></a></td>
			</tr>

			<%
        int i = 0;
        String strIsChecked = new String("Checked");
        String strClassType = new String();   
        Integer nOrgId = null;
        String strOrgName = "";    
        String strOrgCode = ""; 
     %>
			<logic:iterate id="org" collection="<%= orgs %>">

				<%
       HashMap orgMap = (HashMap)pageContext.getAttribute("org"); 
       if(i%2 == 1)
       {
         strClassType = "td-listrom";
       }else{                    
         strClassType = "";
       }
       if(i != 0)
       {          
         strIsChecked = "";
       }
       else
       {
         nOrgId = (Integer)(orgMap.get("hospitalid"));
         strOrgName = (String)(orgMap.get("hospitalname"));  
         strOrgCode = (String)(orgMap.get("hospitalcode"));  
       }  
              
       i++;        
     %>
				<tr onmouseover="this.className='tr-over'"
					onmouseout="this.className='<%=JspHelper.filterNull(strClassType)%>'"
					class="<%=JspHelper.filterNull(strClassType)%>"
					onClick="javascript:radiotrue('selectItem<%=JspHelper.filterNull( i )%>');
                             page_setHospital('<%=JspHelper.filterNull( orgMap.get("hospitalid") )%>', '<%= OvalTools.replaceQuot(orgMap.get("hospitalname")) %>','<%= OvalTools.replaceQuot(orgMap.get("hospitalcode")) %>','<%=OvalTools.replaceQuot(orgMap.get("hospitallevelname"))%>')">
					<td><input id="selectItem<%=JspHelper.filterNull( i )%>"
						type="radio" name="selectOrg" class="normalradio"
						value="<%=JspHelper.filterNull( orgMap.get("hospitalid") )%>"
						<%=JspHelper.filterNull( strIsChecked )%>></td>
					<td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( orgMap.get("hospitalcode") )%></td>
					<td class="<%=JspHelper.filterNull( strClassType )%>">&nbsp;<%=JspHelper.filterNull( orgMap.get("hospitalname") )%></td>
				</tr>
			</logic:iterate>
			<%@ include file="/inc/SummaryActionPop.inc"%>
		</table>
		</td>
	</tr>
</table>
</form>
<%
	if (orgs.size() == 1) {
%>
<script>setParentValue();</script>
<%	} else if (orgs.size() == 0) { %>
<script>setError();</script>
<%	} %>
</body>
</html>
